Have you heard the news? There’s now a free version of GitHub Copilot, no subscription required! GitHub Copilot Free works in VS Code and on GitHub.com for up to 2,000 code completions and 50 Copilot Chat messages each month. And as we said, absolutely no credit card or subscription is needed. Just bring your GitHub account and we’ll take care of the rest.
GitHub Copilot Free users can choose between the GPT-4o and Claude 3.5 Sonnett models, but GitHub Copilot Pro, for unlimited code completions and chat messages, also includes access to Google’s Gemini 1.5 Pro, OpenAI’s o1-preview and o1-mini, and more.
Here are three of our favorite things we think you should check out with GitHub Copilot Free.
1. Change your AI model 🧑🏾💻
By default, GitHub Copilot uses GPT-4o as its AI model for GitHub Copilot Chat, but you can choose what AI model you want to use, including Anthropic’s excellent Claude 3.5 Sonnet model.
Why use a different AI model? Well, some models are better skilled at different tasks and you can get different (and sometimes more relevant) results, depending on your use case or the language you are using.
GitHub Copilot Free users can choose between GPT-4o and Claude 3.5 Sonnett, but GitHub Copilot Pro also includes access to Google’s Gemini 1.5 Pro, OpenAI’s o1-preview, and OpenAI’s o1-mini.
And if you want to explore more with various AI models, be sure to check out GitHub Models.
2. Make changes to multiple files at once using Copilot edits 🌐
Using the new Copilot Edits (currently in preview) in VS Code, you can make changes across multiple files with just a single click.
This way, instead of having to edit files one at a time, you can give Copilot Chat a set of working files and make edits across all those files using natural language.
For instance, if we wanted to change the way pagination looked on a web app, we can simply add the files where our pagination component exists and then ask Copilot to change the way the pagination is displayed.
To get started with Copilot Edits, press Shift+Command+I on Mac (Ctrl+Shift+I on Windows) to open the new Copilot Edits window. You can then add files to your working set for your edit session.
Once the files you’ve selected are added (right now, the limit is 10 files on the free tier), you can use Copilot Chat to request edits to those files.
You can learn more about Copilot Edits on the VS Code Docs page.
3. Generate unit tests 🤓
Unit tests are often the unsung heroes of your project – the things that make sure everything runs smoothly behind the scenes and that your code is working as it is expected to work. But let’s be honest, writing unit tests can often feel like your least favorite chore.
Fortunately, GitHub Copilot Chat in VS Code can save the day, cranking out those tests for you faster than you can say “debugging nightmare” – so you can focus on the more fun parts of coding instead.
To generate unit tests with GitHub Copilot Chat inside VS Code, we’re going to use the /tests command. (You can learn more about slash commands you can use in GitHub Copilot Chat in VS code here.)
And to help give us a real-world example, let’s use our brand new (and extremely cool) Copilot Chat “Cookbook” for some guidance. With this cookbook, you’ll find clear, step-by-step “recipes” that make solving coding challenges easier than ever! 🧑🍳
In this scenario, we have a Python function that validates data before updating the database. We want our unit test to ensure that validation works as we expect it to.
So this is our sample function:
def validate_price(price: float):
if price <= 0:
raise ValueError("Price must be greater than 0")
if price > 1000:
raise ValueError("Price must be less than or equal to 1000")
In VS Code, we’ll use the following prompt in our Copilot Chat window:
/tests Generate unit tests for this function. Validate both success and failure, and include edge cases.
And like a great sous chef, Copilot Chat will give us directions for how to implement our tests, as well as the test themselves.
Remember, you get 50 Copilot Chat completions each month with Copilot Free.
And don’t forget to check out the Copilot Chat Cookbook for even more sample prompts and tips!
We can’t wait to see what you do with GitHub Copilot!
Get started with Copilot for free
✨ This newsletter was written by Christina Warren and produced by Gwen Davis. ✨
More to explore 🌎
Join our GitHub Copilot conversations 🤖
Visit our community forum to see what people are saying + offer your own two cents.
Stay updated on GitHub products 📦
Discover the latest ships, launches, and improvements in our Changelog.
Explore the 2024 Octoverse report 📊
From a global surge in developer contributions to how AI propelled Python to the top, uncover the key development trends shaping the future.
Subscribe to our LinkedIn newsletter 🚀
Do your best work on GitHub. Subscribe to our LinkedIn newsletter, Branching Out_.